syntax = "proto3";

import "common.proto";


// Data needs to be sent each time
// Server can't create a Hanlder
// instance without it
message HandlerContextML {
    int32 integration_id = 1;
    int32 predictor_id = 2;
    string context = 3;
    string handler_params = 4;
}

message PredictCall {
    HandlerContextML context = 1;
    bytes df = 2;
    string args = 3;
}

message CreateCall {
    HandlerContextML context = 1;
    string target = 2;
    bytes df = 3;
    string args = 4;
}

message UpdateCall {
    HandlerContextML context = 1;
    bytes df = 3;
    string args = 4;
}

service MLService {
  // A simple RPC.
  //
  // Performs 'predict' request and returns the result
  //
  // wrapped into Response object
  rpc Predict(PredictCall) returns (Response) {}

  // A simple RPC.
  //
  // Performs 'learn' request and returns the result
  //
  // wrapped into Response object
  rpc Create(CreateCall) returns (StatusResponse) {}

  // A simple RPC.
  //
  // Performs 'update' request and returns the result
  //
  // wrapped into Response object
  rpc Update(UpdateCall) returns (StatusResponse) {}
}
